<?php 
session_start();

if (empty($_SESSION["id_usu"])) 
  {
    ?>
		<script type="text/javascript">window.location="index.php"; </script> 
<?php  
  }
 
include("conexion.php");

$sql =mysql_query("SELECT * FROM tipokar",$conn) or die(mysql_error());
$not =mysql_query("SELECT * FROM notarios",$conn) or die(mysql_error());
$doc =mysql_query("SELECT * FROM tipodocumento",$conn) or die(mysql_error());

$hora = getdate(time());
$horaingreso= $hora["hours"] . ":" . $hora["minutes"] . ":" . $hora["seconds"]; 
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="JavaScript" type="text/javascript" src="ajax.js"></script>
<script src="jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery.uniform.js" type="text/javascript" charset="utf-8"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script type="text/javascript">
/*Code By CarlosPC.net*/
$(document).ready(function() {
$(".Contenido").hide(); //Para ocultar los DIV's con contenido
$("ul.tabs li:first").addClass("active").show(); //Activamos el primer TAB
$(".Contenido:first").show(); //Muestra el contenido respectivo al primer TAB
 
//Al clickar sobre los Tabs
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Anula todas las selecciones
$(this).addClass("active"); //Asigna la clase Active al TAB Seleccionado
$(".Contenido").hide(); //Esconde todo el contenido de la tab
var activeTab = $(this).find("a").attr("href"); //Ubica los valores HREF y A para enlazarlos y activarlos
$(activeTab).fadeIn(); //Habilita efecto Fade en la transición de contenidos
return false;
});
});


</script>

<script type="text/javascript" charset="utf-8">
      $(function(){
        $("input, textarea, select, button").uniform();
      });
    </script>

<link rel="stylesheet" href="css/uniform.default.css" type="text/css" media="screen">

<script>
function mostrar_desc(objac)
		{
		
		if(document.getElementById(objac).style.display=="none")
		document.getElementById(objac).style.display=""
		else
		document.getElementById(objac).style.display="";
		}
function ocultar_desc(objac2)
		{
		
		if(document.getElementById(objac2).style.display=="")
		document.getElementById(objac2).style.display="none"
		else
		document.getElementById(objac2).style.display="none";
		}		
function valida()
    {
        if(frmprotocolares.codactos.value==""){
        alert("Los campos de codigo de actos, contratos o tipos de kardex estan vacios o no han sido seleccionados, por favor ingresar datos");
        frmprotocolares.contrato.focus();
        retun
        }else{
		generakardex();
		mostrar_desc('tabsss');
		ocultar_desc('menuactos');
		
		
		}	
        
    }

function validar2()
    {  
      condiciones();
	   mostrar_desc('menucondicion');
    }


function validar4()
	 {  
	    mostrar_desc('uifpdtparticip');
		mostraruifpdtparticipante()
    }	
	
	
</script>
<script language="javascript">
<!--
function mostrar(isChecked, myValue)
{	
	total = document.frmprotocolares.contrato.value;
	separador=" / ";
	quitar=myValue + separador;
	nuevoStr="";
	if (isChecked) document.frmprotocolares.contrato.value = total + myValue + separador;

	else document.frmprotocolares.contrato.value = total.replace(quitar,nuevoStr);


}
function mostrarfirma(isChecked, myValue)
{ 
    total = document.frmprotocolares.firma.value;
	remplazo="0";
	if (isChecked) document.frmprotocolares.firma.value = total.replace(total,"") + myValue;

	else document.frmprotocolares.firma.value = total.replace(total,remplazo);


}
function mostrarindice(isChecked, myValue)
{ 
    total = document.frmprotocolares.indice.value;
	remplazo="0";
	if (isChecked) document.frmprotocolares.indice.value = total.replace(total,"") + myValue;

	else document.frmprotocolares.indice.value = total.replace(total,remplazo);


}

function seleccionarcontra(valor) {

document.frmprotocolares.representaa.value=valor;
ocultar_desc('representante');
}
function buttons(valor) {
document.frmprotocolares.repre.value=valor;
ocultar_desc('representante');
document.frmprotocolares.representaa.value="";
}
function buttons23(valor) {
document.frmprotocolares.repre.value=valor;
mostrar_desc('representante');
mostrarcontrata();

}
function mostrar2(isChecked, name)
{
	total2 = document.frmprotocolares.codactos.value;
     quitar2=name;
	if (isChecked) document.frmprotocolares.codactos.value = total2 + name;

	else document.frmprotocolares.codactos.value = total2.replace(quitar2,"");


}
function mostrar3(isChecked, name, id)
{
	total3 = document.frmprotocolares.codcon.value;
	quitar3=name +"."+ id + "/";
	if (isChecked) document.frmprotocolares.codcon.value = total3 + name +"."+ id + "/";

	else document.frmprotocolares.codcon.value = total3.replace(quitar3,"");


}
-->
</script>

<style type="text/css">
<!--
.submenutitu {
	font-family: Calibri;
	font-size: 18px;
	font-style: italic;
	color:#FF9900;
}
.titubusca {
	font-family: Calibri;
	font-size: 13px;
	color: #333333;
	font-style: italic;
}
-->
</style>
<style type="text/css">
<!--
.camposss {font-family: Calibri; font-style: italic; font-size: 14px; color: #333333; }

<style type="text/css">
<!--
ul.tabs {margin: 0;  padding: 0;  float: left;  list-style: none;  height: auto;  width: 760px; border-left:2px solid #264965; border-bottom:2px solid #777; }
ul.tabs li { background:#264965; float: left;  margin-left: 0px;  padding: 0; border: 2px solid #777; overflow: hidden; position: relative; background: #264965; border-left:0px; margin-bottom:-2px;}
ul.tabs li a {text-decoration: none; background:#CCCCCC; display: block; font-size: 14px; font-weight:bold; padding: 4px 20px; }
ul.tabs li a:hover {background: #264965;}
ul.tabs li.active, html ul.tabs li.active a:hover  {background: #264965; border-bottom: 2px solid #eee; margin-bottom:-2px;}
 
.Contenedor{border: 2px solid #777; border-top: none; overflow: hidden; clear: both; float: left; width: 760px; background: #ffff;
-webkit-border-bottom-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-moz-border-radius-bottomright: 8px;
-moz-border-radius-bottomleft: 8px;
border-bottom-right-radius: 8px;
border-bottom-left-radius: 8px;
}
.Contenido {padding: 15px; font-size: 12px;}
-->
</style>

<style type="text/css">
<!--

.slectcontratantes {
	font-family: Calibri;
	font-size: 12px;
	color: #FFFFFF;
}


div.newproto
{ 
background-color: #ffffff;
border: 4px solid #264965;  
-moz-border-radius: 13px;
-webkit-border-radius: 13px;
border-radius: 13px;
-moz-box-shadow: 0px 0px 5px #000000;
-webkit-box-shadow: 0px 0px 5px #000000;
box-shadow: 0px 0px 5px #000000;
width:820px; height:750px;
}


div.buscar{ width:620px; height:420px;
 background-color: #264965;
border: 4px solid #264965;
-moz-border-radius: 13px;
-webkit-border-radius: 13px;
border-radius: 13px;
-moz-box-shadow: 0px 0px 5px #000000;
-webkit-box-shadow: 0px 0px 5px #000000;
box-shadow: 0px 0px 5px #000000;  }

div.mante{ width:310px; height:420px;
background-color: #264965;
border: 4px solid #264965;
-moz-border-radius: 13px;
-webkit-border-radius: 13px;
border-radius: 13px;
-moz-box-shadow: 0px 0px 5px #000000;
-webkit-box-shadow: 0px 0px 5px #000000;
box-shadow: 0px 0px 5px #000000;  }

div.contratantes{ width:720px; height:120px; overflow:auto;  }

.editcampp {font-family: Calibri; font-style: italic; font-size: 14px; color: #FFFFFF; }

.titulomenuacto { font-family:Calibri; color:#FFFFFF; font-size:14px; font-style:italic;
}

div.tipoacto{ width:740px; height:150px; overflow:auto;}
div.newproto1 {  background-color: #ffffff;
border: 4px solid #264965;  

-moz-border-radius: 13px;
-webkit-border-radius: 13px;
border-radius: 13px;
-moz-box-shadow: 0px 0px 5px #000000;
-webkit-box-shadow: 0px 0px 5px #000000;
box-shadow: 0px 0px 5px #000000;
width:800px; height:600px;
}
.kardex{ font-family:Calibri; font-size:24px; font-style:italic; color:#003366}
div.menucondicion{
	background:#333333;
	border: 1px solid #333333;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
	border-radius: 10px;
	-moz-box-shadow: 0px 0px 7px #000000;
	-webkit-box-shadow: 0px 0px 7px #000000;
	box-shadow: 0px 0px 7px #000000;
	width:750px;
	height:200px;
	position:absolute;
	left: 496px;
	top: 330px;
	margin-top: 15px;
	margin-left: -450px;
	opacity: 0.95;
	filter: "alpha(opacity=50)"; /* expected to work in IE 8 */
	filter: alpha(opacity=50);   /* IE 4-7 */
	zoom: 1;
}
div.uifpdtparticip{
	background:#333333;
	border: 1px solid #333333;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
	border-radius: 10px;
	-moz-box-shadow: 0px 0px 7px #000000;
	-webkit-box-shadow: 0px 0px 7px #000000;
	box-shadow: 0px 0px 7px #000000;
	width:760px;
	height:299px;
	position:absolute;
	left: 491px;
	top: 333px;
	margin-top: 15px;
	margin-left: -450px;
	opacity: 0.95;
	filter: "alpha(opacity=70)"; /* expected to work in IE 8 */
	filter: alpha(opacity=70);   /* IE 4-7 */
	zoom: 1;
}

div.menuactos {
	background:#333333;
	border: 1px solid #333333;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
	border-radius: 10px;
	-moz-box-shadow: 0px 0px 7px #000000;
	-webkit-box-shadow: 0px 0px 7px #000000;
	box-shadow: 0px 0px 7px #000000;
	width:760px;
	height:220px;
	position:absolute;
	left: 490px;
	top: 179px;
	margin-top: 15px;
	margin-left: -450px;
	opacity: 0.95;
	filter: "alpha(opacity=50)"; /* expected to work in IE 8 */
	filter: alpha(opacity=50);   /* IE 4-7 */
	zoom: 1;
}
div.menuactos2 {
	background:#333333;
	border: 1px solid #333333;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
	border-radius: 10px;
	-moz-box-shadow: 0px 0px 7px #000000;
	-webkit-box-shadow: 0px 0px 7px #000000;
	box-shadow: 0px 0px 7px #000000;
	width:759px;
	height:220px;
	position:absolute;
	left: 482px;
	top: 172px;
	margin-top: 15px;
	margin-left: -450px;
	opacity: 0.95;
	filter: "alpha(opacity=50)"; /* expected to work in IE 8 */
	filter: alpha(opacity=50);   /* IE 4-7 */
	zoom: 1;
}
div.asigna{ height:220px; width:728px; overflow:auto;


}
div.tipoacto2 {width:740px; height:150px; overflow:auto;}
-->
</style>
</head>

<body>
<div class="newproto" id="newproto">
  
  <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td><form id="frmprotocolares" name="frmprotocolares" method="post" action="actualizar_kardex.php">
    <table width="820" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="36" height="28" align="center" bgcolor="#264965"><img src="iconos/nuevo2.png" width="20" height="22" /></td>
        <td width="745" bgcolor="#264965"><span class="submenutitu">Nuevo Kardex</span></td>
      </tr>
      <tr>
        <td colspan="2"><table width="757" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="243" height="26" valign="bottom"><span class="camposss">Tipo de Kardex : </span></td>
            <td width="128" height="26" valign="bottom"><span class="camposss">Fecha de Ingreso</span></td>
            <td width="90" align="left" valign="bottom" class="camposss">Hora</td>
            <td width="155" height="26" valign="bottom" class="camposss">&nbsp;</td>
            <td width="141" rowspan="3" align="center" valign="middle"><div id="resultado" style="width:100px;"><a href='#' onClick="valida()"><img src='imagenes/generar.jpg' width='95' title='Editar Usuario' height='29' border='0' /></a></div></td>
          </tr>
          <tr>
            <td height="31"><select name="idtipkar" id="idtipkar" onChange="tipoacto();mostrar_desc('menuactos')">
              <option value = "" selected="selected">SELECCIONAR TIPO DE KARDEX</option>
              <?php
		  while($row=mysql_fetch_array($sql)){
		  echo "<option value = ".$row["idtipkar"].">".nl2br($row["nomtipkar"])."</option>";  
		  }
		?>
            </select></td>
            <td height="31"><input type="text" readonly="readonly" name="fechaingreso" id="fecha_ingreso"  size="18" value="<?php echo date("d/m/Y"); ?>" 
 /></td>
            <td width="90" align="center" valign="middle"><label>
              <input name="horaingreso" readonly="readonly" type="text" value="<?php echo $horaingreso; ?>" id="horaingreso" size="15" />
            </label></td>
            <td height="31" align="right" class="kardex">Nº Kardex:</td>
          </tr>
          <tr>
            <td height="28" colspan="4" valign="bottom"><table width="555" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="75" height="27"><span class="camposss">Referencia :</span></td>
                <td width="480"><input name="referencia" type="text" id="referencia" size="80" /></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td height="28" colspan="4"><table width="524" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="97"><span class="camposss">Codigo de  Actos
                  <label></label>
                </span></td>
                <td width="427"><span class="camposss">
                  <input name="codactos"  type="text" id="codactos" size="12" />
                </span></td>
              </tr>
            </table>
              <label></label></td>
            <td height="28">&nbsp;</td>
          </tr>
          <tr>
            <td height="14" colspan="5" class="camposss"><table width="751" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="97">Contrato</td>
                <td width="689"><table width="666" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="517" height="27"><label>
                      <input name="contrato" type="text" id="contrato" size="80" />
                      </label>                    </td>
                    <td width="74"><a onClick="tipoacto();mostrar_desc('menuactos')"><img src="imagenes/selactos.jpg" width="64" height="27" /></a>
                            <div id="menuactos" class="menuactos" style="display:none; z-index:2;" >
                                <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td height="29" colspan="2" class="style30"><table width="196" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                          <td width="16">&nbsp;</td>
                                          <td width="180"><span class="titulomenuacto">Seleccione Acto(s)</span></td>
                                        </tr>
                                    </table></td>
                                    <td width="21" align="right" valign="middle">&nbsp;</td>
                                  </tr>
                                  <tr>
                                    <td height="50" colspan="3"><div id="tipoacto" class="tipoacto"></div></td>
                                  </tr>
                                  <tr>
                                    <td width="607" height="10">&nbsp;</td>
                                    <td width="132"><a href='#' onClick="ocultar_desc('menuactos')"><img src="iconos/aceptar.png" width="95" height="29" border="0" /></a></td>
                                    <td height="10">&nbsp;</td>
                                  </tr>
                                  <tr>
                                    <td colspan="3" align="center" valign="middle"></td>
                                  </tr>
                                  <tr></tr>
                                </table>
                              </div></td>
                    <td width="75"><a onClick="tipoacto2();mostrar_desc('menuactos2')"><img src="imagenes/selactos.jpg" width="64" height="27" /></a><div id="menuactos2" class="menuactos2" style="display:none; z-index:3;" >
  <table width="755" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td height="29" colspan="2" class="style30"><table width="196" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="16">&nbsp;</td>
          <td width="180"><span class="titulomenuacto">Quitar Acto(s)</span></td>
        </tr>
      </table></td>
      <td width="21" align="right" valign="middle">&nbsp;</td>
    </tr>
    <tr>
      <td height="50" colspan="3"><div id="tipoacto2" class="tipoacto2"></div></td>
    </tr>
    <tr>
      <td width="607" height="10">&nbsp;</td>
      <td width="132"><a href='#' onClick="ocultar_desc('menuactos2')"><img src="iconos/aceptar.png" width="95" height="29" border="0" /></a></td>
      <td height="10">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="3" align="center" valign="middle"></td>
    </tr>
    <tr></tr>
  </table>
</div></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td height="32" colspan="5">
              ----------------------------------------------------------------------------------------------------------------------------</td>
          </tr>
          <tr>
            <td height="14" colspan="5"><div id="uifpdtparticip" class="uifpdtparticip" style="display:none; z-index:6;">
            <table width="760" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="23" height="29">&nbsp;</td>
    <td colspan="4">UIF - PDT Participa</td>
    <td width="35"><a  onClick="ocultar_desc('uifpdtparticip')"><img src="iconos/cerrar.png" width="21" height="20" /></a></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="5"><table width="728" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
      <tr>
        <td><table width="691" bgcolor="#999999" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
          <tr>
            <td width="134">acto</td>
            <td width="253">contratante</td>
            <td width="96">sunat 12</td>
            <td width="109"><label>porcentaje</label></td>
            <td width="33">uif</td>
            <td width="52">&nbsp;</td>
          </tr>
        </table></td>
        </tr>
      <tr>
        <td><div id="asigna" class="asigna"></div></td>
        </tr>
    </table></td>
    </tr>
  <tr>
    <td>&nbsp;</td>
    <td width="228">&nbsp;</td>
    <td width="125">&nbsp;</td>
    <td width="125">&nbsp;</td>
    <td width="224">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

            </div>
            <div id="tabsss" style="display:; z-index:1;">
       <table width="755" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="92" class="camposss">Kardex Conexo</td>
    <td width="122"><input name="kardexconexo" type="text" id="kardexconexo" size="15" /></td>
    <td width="49" class="camposss">Notaria</td>
    <td width="492"><label>
    <select name="idnotario" id="idnotario">
      <option value = "" selected="selected">SELECCIONE NOTARIA</option>
      <?php
		  while($row2=mysql_fetch_array($not)){
		  echo "<option value = ".$row2["idnotario"].">".nl2br($row2["descon"])."</option>";  
		  }
		?>
    </select>
    </label></td>
  </tr>
  <tr>
    <td colspan="4"><label></label></td>
    </tr>
  <tr>
    <td colspan="4"><ul class="tabs">
          <li><a href="#tab1">Contratantes</a></li>
          <li><a href="#tab2">Presupuesto</a></li>
          <li><a href="#tab3">Facturación</a></li>
          <li><a href="#tab4">Escrituración</a></li>
          <li><a href="#tab5">Cargos</a></li>
          <li><a href="#tab6">Registros Públicos</a></li>
        </ul>
        <div class="Contenedor">
          <div id="tab1" class="Contenido"><table width="739" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="38">&nbsp;</td>
    <td width="190"><label>
      <select name="tipoper" id="tipoper" >
      <option value = "" selected="selected">TIPO DE PERSONA</option>
        <option value="N">Natural</option>
        <option value="J">Jurídica</option>
      </select>
    </label></td>
    <td width="163"><select name="tipdoc" id="tipodoc" >
      <option value = "" selected="selected">TIPO DE DOCUMENTO</option>
      <?php
		  while($row3=mysql_fetch_array($doc)){
		  echo "<option value = ".$row3["idtipdoc"].">".nl2br($row3["destipdoc"])."</option>";  
		  }
		?>
    </select></td>
    <td width="200" align="right"><input type="text" name="numdoc" id="numdoc" onkeypress="buscaclientes()" /></td>
    <td width="139" align="center"><a  onClick="buscaclientes()"><img src="iconos/buscarclie.png" width="72" height="29" border="0" /></a></td>
  </tr>
  <tr>
    <td height="18" colspan="5">&nbsp;</td>
  </tr>
  <tr>
    <td height="54" colspan="5"><div id="busclie" style=" width:720px; height:180px; overflow:auto"> </div></td>
  </tr>
  <tr>
    <td height="7" colspan="5">-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</td>
  </tr>
  <tr>
    <td height="8" colspan="5"><a onclick="mostrarcontratante()"><img src="iconos/mostrarcontratantes.png" width="134" height="28" border="0" />Contratantes</a></td>
  </tr>
  <tr>
    <td height="15" colspan="5">&nbsp;</td>
  </tr>
  <tr>
    <td height="43" colspan="5" ><div id="contratantes" class="contratantes"> </div></td>
    </tr>
  <tr>
    <td colspan="5">&nbsp;</td>
  </tr>
</table>
</div>
          <div id="tab2" class="Contenido"><table width="650" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</div>
          <div id="tab3" class="Contenido">Contenido llamado al dar click en el Item 03</div>
          <div id="tab4" class="Contenido">Contenido llamado al dar click en el Item 04</div>
          <div id="tab5" class="Contenido">Contenido llamado al dar click en el Item 04</div>
          <div id="tab6" class="Contenido">Contenido llamado al dar click en el Item 04</div>
        </div></td>
    </tr>
</table>
<input type="button" name="button" id="button" value="Actualizar" onClick="actualizarkardex()" />
              <input type="button" name="button2" id="button2" value="UIF/PDT Participantes"  onclick="validar4()"/>
              <input type="button" name="button3" id="button3" value="UIF/PDT Patrimonial" onClick="mostraruifpdtparticipante()"/>
      </div></td>
          </tr>
          
        </table></td>
      </tr>
    </table>
  </form></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
  </table>
</div>
</body>

</html>
<?php  ?>